--[[
	Kindly donated by phelps
]]
ccR_Timer = {
	frame = CreateFrame("frame"),
	events = { },
	Register = function(name, callback, interval)
		if not ccR_Timer.events[name] then
			local event = { }
			event.callback = callback
			event.interval = interval
			event.elapsed = 0
			ccR_Timer.events[name] = event
			return true
		end
		return false
	end,
	Unregister = function(name)
		if ccR_Timer.events[name] then
			ccR_Timer.events[name] = nil
			return true
		end
		return false
	end,
	OnUpdate = function(self, elapsed)
		if not FireHack then return end
		for name, event in pairs(ccR_Timer.events) do
			event.elapsed = event.elapsed + elapsed
			if event.elapsed > event.interval then
				event.callback()
				event.elapsed = 0
			end
		end
	end,
	init = function()
		ccR_Timer.frame:SetScript("OnUpdate", ccR_Timer.OnUpdate)
	end
}
ccR_Timer.init()